-- 设置快捷键
local keymap = vim.keymap

-- 退出相关快捷键
-- 使用 Leader 键组合
keymap.set('n', '.q', ':bdelete<CR>', { noremap = true, silent = true, desc = 'Close current buffer' })
keymap.set('n', '.Q', ':bdelete!<CR>', { noremap = true, silent = true, desc = 'Close current buffer in force' })

keymap.set('n', '<leader>w', ':w<cr>', { desc = '保存' })
keymap.set('n', '<leader>q', ':q<cr>', { desc = '退出所有' })
keymap.set('n', '<leader>e', ':x<cr>', { desc = '保存并退出（如果修改过）' })
keymap.set('n', '<leader>E', ':q!<cr>', { desc = '强制退出' })


-- 基础配置：使用黑孔寄存器进行删除，避免覆盖默认寄存器
-- keymap.set('n', 'd', '"_d', { noremap = true, desc = "Delete without yanking" })
-- keymap.set('v', 'd', '"_d', { noremap = true, desc = "Delete visual selection without yanking" })
-- keymap.set('n', 'D', '"_D', { noremap = true, desc = "Delete line without yanking" })
-- keymap.set('n', 'x', '"_x', { noremap = true, desc = "Delete character without yanking" })
-- keymap.set('v', 'x', '"_x', { noremap = true, desc = "Delete character in visual selection without yanking" })
-- keymap.set('n', 'X', '"_X', { noremap = true, desc = "Delete character without yanking" })
-- keymap.set('n', 'y', '"_y', { noremap = true, desc = "yank without yanking" })
-- keymap.set('v', 'y', '"_y', { noremap = true, desc = "yank visual selection without yanking" })
-- keymap.set('n', 'Y', '"_Y', { noremap = true, desc = "yank line without yanking" })

-- 为需要传统剪切行为的操作定义新的快捷键，使用 leader 键组合进行会覆盖寄存器的"真正"剪切
-- keymap.set('n', '<leader>d', 'd', { noremap = true, desc = "Original delete (yank)" })
-- keymap.set('n', '<leader>D', 'D', { noremap = true, desc = "Original delete line (yank)" })
-- keymap.set('v', '<leader>d', 'd', { noremap = true, desc = "Original delete visual (yank)" })
-- keymap.set('n', '<leader>x', 'x', { noremap = true, desc = "Original delete (yank)" })
-- keymap.set('n', '<leader>X', 'X', { noremap = true, desc = "Original delete line (yank)" })
-- keymap.set('v', '<leader>x', 'x', { noremap = true, desc = "Original delete visual (yank)" })
-- keymap.set('n', '<leader>x', 'y', { noremap = true, desc = "Original yank" })
-- keymap.set('n', '<leader>X', 'Y', { noremap = true, desc = "Original line (yank)" })
-- keymap.set('v', '<leader>x', 'y', { noremap = true, desc = "Original visual (yank)" })

-- c s x 等都还没配置
